home *** CD-ROM | disk | FTP | other *** search
/ Emulator Universe CD / emulatoruniversecd1998.iso / CPC / Utils / CpcFile System / CPCFS.C next >
Encoding:
C/C++ Source or Header  |  1996-02-08  |  3.2 KB  |  162 lines

  1.  
  2. /*                <<<<Last Modified: Thu Feb 08 15:07:16 1996>>>>
  3. ------------------------------------------------------------------------------
  4.  
  5.     =====
  6.     CPCfs -- CPCEmu Filesystem Maintenance
  7.         =====                   especially for CPCEmu
  8.  
  9.     Version 0.85                    (c) February '96 by Derik van Zuetphen
  10. ------------------------------------------------------------------------------
  11. */
  12.  
  13.  
  14. #include "cpcfs.h"
  15.  
  16. /***********
  17.   Variables
  18.  ***********/
  19.  
  20. /****** CPC Filesystem ******/
  21.  
  22. char    full_imagename[65];    /* full pathname, ... */
  23. char    *imagename;        /* ... only name portion, and ... */
  24. int    imagefile;        /* ... handle of imagefile */
  25.  
  26. int    cur_user    = 0;
  27. int    cur_format;
  28. int    BLKNR_SIZE     = 1;
  29. int    BLKNR         = 16;
  30.  
  31. uchar    *track = NULL;    /* 0x100 header + track data */
  32. unsigned char filler;    /* copied from track header */
  33.  
  34. uchar    *block_buffer = NULL;    /* Buffer for 1024 or more bytes */
  35.  
  36. uchar    *blk_alloc = NULL;    /* Block-Allocation-Table, */
  37.                 /* chars point to fcb, FF = free block */
  38. int    allocated_blks;
  39. int    free_blks;
  40. int    total_blks;    /* = allocated_blks + free_blks */
  41. float    percentage;    /* of allocated blocks */
  42.  
  43. int    mode;        /* Mode for GET-commands */
  44. bool    force;
  45.  
  46. struct d_header disk_header;
  47.  
  48.  
  49. /****** User Interface *****/
  50. int    nbof_args;
  51. char    *arg[INPUTLEN];
  52. char    prompt[INPUTLEN];
  53. int    pagelen, lineno;
  54. bool    Break_Wish;
  55. jmp_buf break_entry;
  56. bool    Interactive;
  57. char    installpath[INPUTLEN];        /* path of argv[0] */
  58. int    Verb = 9;
  59.  
  60. DirEntry *directory = (DirEntry*)NULL;
  61.  
  62. char stamp[] = "Compiled: " STAMP ", (C) Dec. 1995 Derik van Zütphen";
  63.  
  64.  
  65. /****** Disk Parameter Block ******/
  66.  
  67. /* DPB templates for SYSTEM, DATA, IBM, VORTEX, and user defined */
  68. #define DPB_store_size  5
  69. DPB_type DPB_store[DPB_store_size] = {
  70. /* SYSTEM */
  71.     {    SYSTEMFORMAT, /* ID */
  72.         SYSTEMFORMAT, /* SEC1 */
  73.         9,    /* SECS */
  74.         40,    /* TRKS */
  75.         1,    /* HDS */
  76.         512,    /* BPS */
  77.  
  78.         36,    /* SPT */
  79.         3,    /* BSH */
  80.         7,    /* BLM */
  81.         0,    /* EXM */
  82.         168,    /* DSM */
  83.         63,    /* DRM */
  84.         0xC0,    /* AL0 */
  85.         0x00,    /* AL1 */
  86.         16,    /* CKS */
  87.         2,    /* OFS */
  88.         0,0,0
  89.     },
  90. /* DATA */
  91.     {    DATAFORMAT, /* ID */
  92.         DATAFORMAT, /* SEC1 */
  93.         9,    /* SECS */
  94.         40,    /* TRKS */
  95.         1,    /* HDS */
  96.         512,    /* BPS */
  97.  
  98.         36,    /* SPT */
  99.         3,    /* BSH */
  100.         7,    /* BLM */
  101.         0,    /* EXM */
  102.         177,    /* DSM */
  103.         63,    /* DRM */
  104.         0xC0,    /* AL0 */
  105.         0x00,    /* AL1 */
  106.         16,    /* CKS */
  107.         0,    /* OFS */
  108.         0,0,0
  109.     },
  110. /* IBM */
  111.     {    IBMFORMAT, /* ID */
  112.         IBMFORMAT, /* SEC1 */
  113.         8,    /* SECS */
  114.         40,    /* TRKS */
  115.         1,    /* HDS */
  116.         512,    /* BPS */
  117.  
  118.         36,    /* SPT */
  119.         3,    /* BSH */
  120.         7,    /* BLM */
  121.         0,    /* EXM */
  122.         153,    /* DSM */
  123.         63,    /* DRM */
  124.         0xC0,    /* AL0 */
  125.         0x00,    /* AL1 */
  126.         16,    /* CKS */
  127.         1,    /* OFS */
  128.         0,0,0
  129.     },
  130. /* VORTEX */
  131.     {       VORTEXFORMAT, /* ID */
  132.         0x01,    /* SEC1 */
  133.         9,    /* SECS */
  134.         80,    /* TRKS */
  135.         2,    /* HDS */
  136.         512,    /* BPS */
  137.  
  138.         36,    /* SPT */
  139.         5,    /* BSH */
  140.         31,    /* BLM */
  141.         3,    /* EXM */
  142.         176,    /* DSM */
  143.         127,    /* DRM */
  144.         0x80,    /* AL0 */
  145.         0x00,    /* AL1 */
  146.         32,    /* CKS */
  147.         2,    /* OFS */
  148.         0,0,0
  149.     }
  150. /* user defined DPB is empty for now */
  151. };
  152.  
  153.  
  154. DPB_type *dpb = NULL;    /* pointer to current DPB */
  155.  
  156.  
  157. void main (int argc, char **argv) {
  158. int    ui_main (int,char**);
  159.     ui_main (argc,argv);
  160.     exit(0);
  161. }
  162.